public class Test {
    //求各数之和
    public static int print(int n) {
        if(n<10){

            return n;
        }
            return (n%10)+print(n/10);
    }

    public static void main(String[] args) {
        int sum=print(1234);
        System.out.println(sum);
    }
}
